package com.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.user.entity.TabUser;
import com.user.mapper.TabUserMapper;
import com.user.service.ITabUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xyw
 * @since 2023-08-09
 */
@Service
public class TabUserServiceImpl extends ServiceImpl<TabUserMapper, TabUser> implements ITabUserService {

    @Resource
    private TabUserMapper userMapper;
    @Override
    public Page getAllUser(Integer currentPage, Integer pageSize, TabUser user) {
        Page page = new Page<>(currentPage,pageSize);
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("status",0);
        if (user.getUsername() != null) {
            queryWrapper.eq("username",user.getUsername());
        }
        return userMapper.getAllUser(page,queryWrapper);
    }
}
